/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.rec.be;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "REC_CASTIGO_CREDITO")
@NamedQueries({@NamedQuery(name = "CastigoCredito.findAll", query = "SELECT c FROM CastigoCredito c"), @NamedQuery(name = "CastigoCredito.findByIdCastigocredito", query = "SELECT c FROM CastigoCredito c WHERE c.idCastigocredito = :idCastigocredito"), @NamedQuery(name = "CastigoCredito.findByFechaAprobacion", query = "SELECT c FROM CastigoCredito c WHERE c.fechaAprobacion = :fechaAprobacion"), @NamedQuery(name = "CastigoCredito.findByMontoDeuda", query = "SELECT c FROM CastigoCredito c WHERE c.montoDeuda = :montoDeuda"), @NamedQuery(name = "CastigoCredito.findByMontoRecuperado", query = "SELECT c FROM CastigoCredito c WHERE c.montoRecuperado = :montoRecuperado"), @NamedQuery(name = "CastigoCredito.findByMontoCastigado", query = "SELECT c FROM CastigoCredito c WHERE c.montoCastigado = :montoCastigado"), @NamedQuery(name = "CastigoCredito.findByAnotacion", query = "SELECT c FROM CastigoCredito c WHERE c.anotacion = :anotacion")})
public class CastigoCredito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CASTIGOCREDITO", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idCastigocredito;
    @Column(name = "FECHA_APROBACION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaAprobacion;
    @Column(name = "MONTO_DEUDA", precision = 53)
    private Double montoDeuda;
    @Column(name = "MONTO_RECUPERADO", precision = 53)
    private Double montoRecuperado;
    @Column(name = "MONTO_CASTIGADO", precision = 53)
    private Double montoCastigado;
    @Column(name = "ANOTACION", length = 50)
    private String anotacion;
    @JoinColumn(name = "FID_REC_PROPOSICION_CASTIGO", referencedColumnName = "ID_PROPOSICION_CASTIGO")
    @ManyToOne(fetch = FetchType.LAZY)
    private ProposicionCastigo fidRecProposicionCastigo;
    @OneToMany(mappedBy = "fidRecCastigoCredito", fetch = FetchType.LAZY)
    private List<ConstanciaIrrecuperabilidad> constanciaIrrecuperabilidadCollection;

    public CastigoCredito() {
    }

    public CastigoCredito(Long idCastigocredito) {
        this.idCastigocredito = idCastigocredito;
    }

    public Long getIdCastigocredito() {
        return idCastigocredito;
    }

    public void setIdCastigocredito(Long idCastigocredito) {
        this.idCastigocredito = idCastigocredito;
    }

    public Date getFechaAprobacion() {
        return fechaAprobacion;
    }

    public void setFechaAprobacion(Date fechaAprobacion) {
        this.fechaAprobacion = fechaAprobacion;
    }

    public Double getMontoDeuda() {
        return montoDeuda;
    }

    public void setMontoDeuda(Double montoDeuda) {
        this.montoDeuda = montoDeuda;
    }

    public Double getMontoRecuperado() {
        return montoRecuperado;
    }

    public void setMontoRecuperado(Double montoRecuperado) {
        this.montoRecuperado = montoRecuperado;
    }

    public Double getMontoCastigado() {
        return montoCastigado;
    }

    public void setMontoCastigado(Double montoCastigado) {
        this.montoCastigado = montoCastigado;
    }

    public String getAnotacion() {
        return anotacion;
    }

    public void setAnotacion(String anotacion) {
        this.anotacion = anotacion;
    }

    public ProposicionCastigo getFidRecProposicionCastigo() {
        return fidRecProposicionCastigo;
    }

    public void setFidRecProposicionCastigo(ProposicionCastigo fidRecProposicionCastigo) {
        this.fidRecProposicionCastigo = fidRecProposicionCastigo;
    }

    public List<ConstanciaIrrecuperabilidad> getConstanciaIrrecuperabilidadCollection() {
        return constanciaIrrecuperabilidadCollection;
    }

    public void setConstanciaIrrecuperabilidadCollection(List<ConstanciaIrrecuperabilidad> constanciaIrrecuperabilidadCollection) {
        this.constanciaIrrecuperabilidadCollection = constanciaIrrecuperabilidadCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCastigocredito != null ? idCastigocredito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CastigoCredito)) {
            return false;
        }
        CastigoCredito other = (CastigoCredito) object;
        if ((this.idCastigocredito == null && other.idCastigocredito != null) || (this.idCastigocredito != null && !this.idCastigocredito.equals(other.idCastigocredito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.rec.be.CastigoCredito[idCastigocredito=" + idCastigocredito + "]";
    }

}
